package com.ruoyi.logistic.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.logistic.domain.NetworkOutboundSettlement;
import com.ruoyi.logistic.domain.NetworkPullUniform;
import com.ruoyi.logistic.domain.PageDate;
import com.ruoyi.logistic.domain.PageInfo;
import com.ruoyi.logistic.domain.vo.NetworkPullUniformSearchVo;
import com.ruoyi.logistic.service.INetworkPullUniformService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/network/pullUniform")
@RestController
@Api(tags = "网点财务_出港拉均配置")
public class NetworkPullUniformController {
    @Autowired
    private INetworkPullUniformService networkPullUniformService;

    @ApiOperation("显示出港拉均配置列表")
    @GetMapping("/selectAll")
    public R selectNetworkPullUniformAll(PageDate pageDate){
        List<NetworkPullUniform> networkPullUniforms = networkPullUniformService.selectAll(pageDate);
        if (networkPullUniforms == null || networkPullUniforms.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(networkPullUniforms));
        }
    }
    @ApiOperation("添加出港拉均配置")
    @PostMapping("/insert")
    public R insertNetworkPullUniform(@RequestBody NetworkPullUniform networkPullUniform){
        Boolean isAdd = networkPullUniformService.insert(networkPullUniform);
        if (isAdd){
            return R.ok("添加成功");
        }else {
            return R.fail("添加失败");
        }
    }
    @ApiOperation("修改出港拉均配置列表")
    @PostMapping("/update")
    public R updateNetworkPullUniform(@RequestBody NetworkPullUniform networkPullUniform){
        Boolean isUpdate = networkPullUniformService.update(networkPullUniform);
        if (isUpdate){
            return R.ok("修改成功");
        }else {
            return R.fail("修改失败");
        }
    }
    @ApiOperation("搜索出港拉均配置列表")
    @PostMapping("/search")
    @ResponseBody
    public R search(@RequestBody NetworkPullUniformSearchVo networkPullUniformSearchVo){
        List<NetworkPullUniform> networkPullUniforms = networkPullUniformService.search(networkPullUniformSearchVo);
        if (networkPullUniforms == null || networkPullUniforms.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(networkPullUniforms));
        }
    }
}
